﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ClassExerises.aspx.cs" Inherits="Manage_basisset_ClassExerises" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
     <script type="text/javascript">
         function checkForm() {
             var question = document.getElementById("txtQuestion");
             var ExerisesType = document.getElementById("ddlExerisesType");
             var sn = document.getElementById("txtSN");
             var ChoseA = document.getElementById("txtChoseA");
             var ChoseB = document.getElementById("txtChoseB");
             var ChoseC = document.getElementById("txtChoseC");
             var ChoseD = document.getElementById("txtChoseD");
             var Answer = document.getElementById("txtAnswer");
             var Score = document.getElementById("txtScore");
             if (ExerisesType.value ==0){
                 alert("请选择题型！");
                 ExerisesType.focus();
                 return false;
             }
             if (sn.value.length == 0) {
                 alert("请填写题号！");
                 sn.focus();
                 return false;
             }
             if (question.value.length == 0) {
                 alert("请填写问题！");
                 question.focus();
                 return false;
             }
             
             if (isNaN(sn.value)) {
                 alert("请题号必需为数字！");
                 sn.focus();
                 return false;
             }
             if (ExerisesType.value ==1 && ChoseA.value.length == 0 && ChoseB.value.length == 0 && ChoseC.value.length == 0 && ChoseD.value.length == 0) {
                 alert("至少要有一个选项！")
                 return false;
             }            
             if (Answer.value.length == 0) {
                 alert("请填写答案！");
                 Answer.focus();
                 return false;
             }
             if (Score.value.length == 0) {
                 alert("请填写分数！");
                 Score.focus();
                 return false;
             }
             if (isNaN(Score.value)) {
                 alert("请分数必需为数字！");
                 Score.focus();
                 return false;
             }

         }
  </script>
    <link rel="stylesheet" type="text/css" href="../skin/css/base.css" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"  EnableScriptGlobalization="True" EnableScriptLocalization="True">
        </asp:ScriptManager>
         <asp:UpdatePanel ID="up1" runat="server" >
    <ContentTemplate>
    
     <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
   
    <tr bgcolor="#E7E7E7" style="border-bottom:none">
	    <td height="24" colspan="4" background="../skin/images/tbg.gif">&nbsp;课程练习题列表</td>
    </tr>
    
    <tr style="background-color:#ffffff">
    <td colspan="4">
          <asp:GridView ID="GridView1" runat="server" Width="100%" CellPadding="4" BorderColor="#D1DDAA"  
                            AutoGenerateColumns="False"  DataKeyNames="ExercisesId"  DataMember="Name" SelectedIndex="0" 
              OnRowDataBound="GridView1_RowDataBound" GridLines="Both" 
              AllowPaging="False" PageIndex="1" onrowcommand="GridView1_RowCommand" >
                            <Columns>
                                <asp:TemplateField HeaderText="题型" >
                                    <ItemTemplate>
                                        <asp:Label ID="lblExercisesType" runat="server" Text='<%#Eval("ExercisesTypeName") %>'></asp:Label>
                                    </ItemTemplate>
                                   
                                    <ItemStyle Width="40px" />
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="题号" >
                                    <ItemTemplate>
                                        <asp:Label ID="lblSN" runat="server" Text='<%# Eval("SN") %>'></asp:Label>
                                    </ItemTemplate>
                                    
                                    <ItemStyle Width="100px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="问题" >
                                    <ItemTemplate>
                                        <asp:Label ID="lblquestion" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
                                    </ItemTemplate>
                                    
                                   
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="答案" >
                                    <ItemTemplate>
                                        <asp:Label ID="lblAnswer" runat="server" Text='<%# Eval("Answer") %>'></asp:Label>
                                    </ItemTemplate>
                                    

                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="分数" >
                                    <ItemTemplate>
                                        <asp:Label ID="lblScore" runat="server" Text='<%# Eval("Score") %>'></asp:Label>
                                    </ItemTemplate>
                                    

                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="操作">
                                    <ItemTemplate>
                                       <asp:LinkButton runat="server" ID="lbtEdit" CommandArgument='<%#Eval("ExercisesId")%>'
                                    CommandName="modify" Text="编辑" Visible='<%#edit==1%>' ></asp:LinkButton>&nbsp;&nbsp;
                                   <asp:LinkButton runat="server" ID="lbtDelete" CommandArgument='<%#Eval("ExercisesId")%>'
                                    CommandName="Del" Text="删除" Visible='<%#delete==1%>' OnClientClick="return confirm('确定要删除？')"></asp:LinkButton>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings FirstPageText="" LastPageText="" NextPageText="" PreviousPageText="" />
                            <RowStyle Height="20px" BackColor="#FFFFFF"  ForeColor="#000000" />
                            <FooterStyle BackColor="#FFFFFF" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#FCFDEE" />
                            <SelectedRowStyle BackColor="#FFFFFF"  ForeColor="#000000" />
                            <PagerStyle BackColor="#FCFDEE" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#FCFDEE"  ForeColor="000000" />
                            <AlternatingRowStyle BackColor="#FCFDEE" ForeColor="#000000" />
                            
                        </asp:GridView>
   </td>
   </tr>
    
    </table>
     <table width="98%" border="0" cellpadding="2" cellspacing="1"  align="center" style="margin-top:8px">
   
    <tr  style="border-bottom:none">
	    <td height="24" style=" text-align:right"> 
            <asp:Button ID="btnAddExerises" runat="server" Text="添加练习题" 
                onclick="btnAddExerises_Click" />
        </td>
    </tr>
    </table>
      <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
        <tr bgcolor="#E7E7E7">
          <td height="24" colspan="5" background="../skin/images/tbg.gif"><div align="left" >
              练习题</div></td>
        </tr>
       <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
           <td align="left" >题型：</td>
           <td align="left"  colspan="4">
             <asp:DropDownList ID="ddlExerisesType" runat="server" Width="200px" 
                   AutoPostBack="True" 
                   onselectedindexchanged="ddlExerisesType_SelectedIndexChanged"></asp:DropDownList>
                   <asp:HiddenField ID="hdfExercisesId" runat="server" Value="0" />
             </td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >题号：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtSN" runat="server"  Width="200px"></asp:TextBox>
             </td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >问题：</td>
            <td  align="left" colspan="4">
                <asp:TextBox ID="txtQuestion" runat="server" TextMode="MultiLine" Width="500px" 
                    Height="55px"></asp:TextBox>
             </td>
        </tr>
        <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >A选项：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtChoseA" runat="server"  Width="500px"></asp:TextBox>
            </td>
        </tr>
         <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left">B选项：</td>
            <td align="left"  colspan="4">
                <asp:TextBox ID="txtChoseB" runat="server"  Width="500px"></asp:TextBox>
                </td>
        </tr>
         <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >C选项：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtChoseC" runat="server"  Width="500px"></asp:TextBox>
           </td>
        </tr>
         <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >D选项：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtChoseD" runat="server"  Width="500px"></asp:TextBox>
           </td>
        </tr>
         <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >答案：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtAnswer" runat="server"  Width="200px"></asp:TextBox>
               <asp:RadioButtonList ID="rblselect" runat="server" RepeatDirection="Horizontal"  Enabled="false"
                    AutoPostBack="True" onselectedindexchanged="rblselect_SelectedIndexChanged" ><asp:ListItem Text="对" Value="对" Selected="True"></asp:ListItem><asp:ListItem Text="错" Value="错"></asp:ListItem></asp:RadioButtonList>
            </td>
        </tr>
         <tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >
            <td align="left" >分数：</td>
            <td align="left" colspan="4">
                <asp:TextBox ID="txtScore" runat="server"  Width="200px"></asp:TextBox>
            </td>
        </tr>
      </table>
     
      <!--  提交 -->
      <table width='98%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center" style="margin-top:8px">
        <tr bgcolor='#EEF4EA'>
          <td background='skin/images/wbg.gif' align='center'><table border='0' cellpadding='0' cellspacing='0' align='center'>
              <tr>
                
                <td ><asp:Button ID="btnsave" runat="server" Text="保存" 
                        OnClientClick="return checkForm();false" onclick="btnsave_Click" /></td>
               
              </tr>
            </table></td>
        </tr>
      </table>
    </ContentTemplate>
     
    </asp:UpdatePanel> 
    </form>
</body>
</html>
